﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SharedGenomics.Workbench.Core;
using SharedGenomics.Core;

namespace SharedGenomics.Workbench.Views.WindowsForms
{
    public partial class ViewDialog : Form, IViewDialog
    {
        private bool _snapshotOnOpen;
        private IView _view;

        public ViewDialog(IPresenter presenter, IView view)
        {
            InitializeComponent();

            Control mainView = (Control)view;

            this.ClientSize = mainView.Size;           //size dialog to show the whole form
            this.Controls.Add(mainView);
            this.Text = view.Title;

            mainView.Dock = DockStyle.Fill;
            presenter.RequestingClose += (o, e) => { this.Close(); };
            _snapshotOnOpen = presenter.SnapshotOnOpen;
            _view = view;
        }

        #region IViewDialog Members

        public void ShowModal()
        {
            this.ShowDialog();
        }

        #endregion
    }
}
